package com.study.samsung.Service;

import com.study.samsung.Dao.ProductDetailsDao;
import com.study.samsung.Entity.*;

import java.math.BigDecimal;
import java.util.List;

public class ProductDetailService {
    ProductDetailsDao pdd = new ProductDetailsDao();
    public List<Commodity> selectAll(Integer lid){
        return pdd.selectAll(lid);
    }
    public Commodity selectOne(Integer sid,Integer nid){
        return pdd.selectOne(sid,nid);
    }
//    从商品列表页进入默认第一个商品
    public Commodity selectSid(Integer lid){
        return pdd.selectSid(lid);
    }

    public List<Commoditymemory> selectmemory(Integer sid){
        return pdd.selectmemory(sid);
    }

    public Commoditymemory selectmemoryone(Integer sid,Integer nid){
        return pdd.selectmemoryone(sid,nid);
    }
    public List<Commoditycolor> selectcolor(){
        return pdd.selectcolor();
    }
    public List<Commodityimg> selectimg(Integer sid){
        return pdd.selectimg(sid);
    }
    public List<Commodityimg> selectxiaimg(Integer sid){
        return pdd.selectxiaimg(sid);
    }

    //加入收藏
    public Integer insertLike(Integer uid,Integer sid,String date){
        return pdd.insertLike(uid,sid,date);
    }
    public Integer selectByOne(Integer sid,Integer uid){
        Collect collect = pdd.selectByOne(sid,uid);
        System.out.println("1222");
        System.out.println(collect);
        if (collect==null){
            return 0;
        }else{
            return 1;
        }
    }
    public Integer deleteOne(Integer sid){
        return pdd.deleteOne(sid);
    }

    //加入购物车

    public Detail selectOneDetail(Integer nid,Integer yid,Integer sid){
        return pdd.selectOneDetail(nid,yid,sid);
    }
    public Integer addCart(Integer num, Integer sxid, Integer uid, BigDecimal gprice){
        return pdd.addCart(num,sxid,uid,gprice);
    }
    public Integer updateCart(Integer sxid,Integer gnum,BigDecimal gprice){
        return pdd.updateCart(sxid,gnum,gprice);
    }
    public ShoppingCart addCartOne(Integer sxid){
        return pdd.addCartOne(sxid);
    }

    //立即购买
    public List<Commodity> buy(Integer sxid){
        return pdd.buy(sxid);
    }

    public List<Detail> prohibit(Integer nid, Integer sid){
        return pdd.prohibit(nid,sid);
    }
    public List<Detail> prohibitColor(Integer yid, Integer sid){
        return pdd.prohibitColor(yid,sid);
    }
}
